package org.example.server.cd;



import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.example.utils.http.RedirectUtil;

import java.util.HashMap;
import java.util.Map;

public class GetAccInfo {
    public Map<String,Object> getToken(){
        Map<String,Object> formMap=new HashMap<String, Object>();
        formMap.put( "appId", "FSAID_131b52e");
        formMap.put("appSecret", "82623bb8c05640289fab929faea377f9");
        formMap.put("permanentCode", "0CB681FB8792D3D79D4AD8A556E054BF");
        String s = RedirectUtil.doPostByJson("https://open.fxiaoke.com/cgi/corpAccessToken/get/V2", JSON.toJSONString(formMap));
        Map<String,Object> resut = JSON.parseObject(s);
        //return resut;
        //        GetAccInfo getAccInfo=new GetAccInfo();

       // System.out.println(JSON.toJSON(resut));

        Map<String,Object> map=new HashMap<>();
        map.put("corpAccessToken",resut.get("corpAccessToken"));
        map.put("corpId",resut.get("corpId"));
        map.put("mobile","18227142950");
        String boby = RedirectUtil.doPostByJson("https://open.fxiaoke.com/cgi/user/getByMobile", JSON.toJSONString(map));
       Map<String,Object> objectMap= JSON.parseObject(boby);
//        System.out.println(objectMap);
//        String a="FSUID_397AC7FEC8A99467C1BF4BC9269C0722";

        Map<String,Object> mapForm=new HashMap<>();
        mapForm.put("corpAccessToken", resut.get("corpAccessToken"));
        mapForm.put("corpId", resut.get("corpId"));
        mapForm.put("currentOpenUserId", "FSUID_397AC7FEC8A99467C1BF4BC9269C0722");
        return mapForm;

    }
}
